Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow APIOptions.trackInteraction()'s arg object to have extra keys #616

Merged
merged 4 commits into from
Jul 25, 2023

Conversation

jeremywiebe
Copy link
Collaborator

Summary:

In #609 I clarified the trackInteraction API types. However, I missed defining that the APIOptions.trackInteraction argument object can have extra, arbitrary keys provided by the widget that originates the interaction.

This PR adds that to the trackInteraction function type.

Issue: "none"

Test plan:

yarn tsc
yarn test

@jeremywiebe jeremywiebe self-assigned this Jul 18, 2023
@changeset-bot
Copy link

changeset-bot bot commented Jul 18, 2023

🦋 Changeset detected

Latest commit: 0e920b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@khanacademy/perseus Minor
@khanacademy/perseus-editor Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jul 18, 2023

Size Change: -45 B (0%)

Total Size: 823 kB

Filename Size Change
packages/perseus/dist/es/index.js 397 kB -45 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38 kB
packages/kmath/dist/es/index.js 4.13 kB
packages/math-input/dist/es/index.js 78 kB
packages/perseus-core/dist/es/index.js 55 B
packages/perseus-editor/dist/es/index.js 268 kB
packages/perseus-error/dist/es/index.js 705 B
packages/perseus-linter/dist/es/index.js 21.2 kB
packages/pure-markdown/dist/es/index.js 3.65 kB
packages/simple-markdown/dist/es/index.js 12.6 kB

compressed-size-action

Comment on lines +14 to +19
type Rubric = PerseusSequenceWidgetOptions;

type ExternalProps = WidgetProps<PerseusSequenceWidgetOptions, Rubric>;

type Props = ExternalProps;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is our more modern way to define prop types for widgets. It uses WidgetProps<> as that defines all the standard props that the Renderer hands down to every widget. The PerseusSequenceWidgetOptions are then the option data that the content author configured for this widget instance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes here are just migrating this widget to use TypeScript types for Props and State.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, thank you 🌈

@jeremywiebe jeremywiebe marked this pull request as ready for review July 18, 2023 21:34
@jeremywiebe jeremywiebe requested review from handeyeco and a team July 18, 2023 21:34
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/sour-bears-fail.md, packages/perseus/src/interaction-tracker.ts, packages/perseus/src/types.ts, packages/perseus/src/widgets/sequence.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@coveralls
Copy link
Collaborator

coveralls commented Jul 18, 2023

Coverage Status

coverage: 69.015% (-0.001%) from 69.016% when pulling 0e920b9 on track-interaction-types.again into 912c7af on main.

Copy link
Contributor

@handeyeco handeyeco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I wonder if this has to do with why I had some issues in the last deploy: https://github.com/Khan/webapp/pull/15270/files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, thank you 🌈

@jeremywiebe
Copy link
Collaborator Author

jeremywiebe commented Jul 24, 2023

Looks good to me. I wonder if this has to do with why I had some issues in the last deploy: https://github.com/Khan/webapp/pull/15270/files

Yes, that was definitely part of the issues we saw in that release.

@jeremywiebe jeremywiebe merged commit 077b125 into main Jul 25, 2023
10 checks passed
@jeremywiebe jeremywiebe deleted the track-interaction-types.again branch July 25, 2023 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants